package cn.edu.zut.internship.mapper.sys;

import cn.edu.zut.internship.entity.AuthSysMenu;
import cn.edu.zut.internship.entity.AuthSysRole;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Map;

@Repository
public interface AuthSysRoleMapper {
    int deleteByPrimaryKey(@Param("roleId")Long roleId);
    int insertSelective(Map role);
    AuthSysRole selectByPrimaryKey(Long rlId);
    int updateByPrimaryKey(Map role);
    List<AuthSysRole> selectByName(String roleName);

    /**
     * 增加一条角色与菜单的绑定记录
     * @param roleId
     * @param menuId
     */
     void assignMenu(@Param("roleId")Long roleId,@Param("menuId")Long menuId);
    void unassignMenus(@Param("roleId")Long roleId);

    /**
     * 根据菜单名查询拥有此菜单权限的角色id
     * @param mnName
     * @return
     */
    List<Long> selectRolesByMnName(String mnName);
    void unassignPermssions(Long rlId);
    void assignPermssion(@Param("rlId") Long rlId,@Param("prmId") Long prmId);

    /**
     * 查询用户角色信息
     * @param userId
     * @return
     */
    List<AuthSysRole> selectByUrId(Long userId);

    List<Map> selectRoleList(Map params);

    List<Long> selectMenuListByRoleId(Long roleId);
}
